#ifndef tlmRmtCfgMsg_H
#define tlmRmtCfgMsg_H

#include "tlmRmtCfg.h"
//## attribute mInboundMsgBuf
#include "msgbuf.h"
//## attribute mProtocolVersion
#include "tlmRmtCfgElement.h"
//## attribute mDataInfo
class tlmRmtCfgDataInfo;

//## operation GetParaAdmin()
class tlmRmtCfgParaAdmin;

//## operation GetParaNavi()
class tlmRmtCfgParaNavi;

//## operation GetParaWeb()
class tlmRmtCfgParaWeb;

//## attribute mSaver
class tlmRmtCfgSaver;

//## operation SetItsService(tlmRmtCfgSrvApp)
class tlmRmtCfgSrvApp;


//## class tlmRmtCfgMsg
class tlmRmtCfgMsg {
public :

    //#[ type de_tlmRmtCfgHeader
    #define TLM_RMT_CFG_HEADER_ONE_BYTE_VALUE_SIZE 1
    
    #define TLM_RMT_CFG_HEADER_TWO_BYTE_VALUE_SIZE 2
    #define TLM_RMT_CFG_HEADER_THREE_BYTE_VALUE_SIZE 3 
    #define TLM_RMT_CFG_HEADER_VIN_VALUE_SIZE 10  
    #define TLM_RMT_CFG_HEADER_DATE_TIME_VALUE_SIZE 4  
    
    //header is fixed length
    #define TLM_RMT_CFG_NGTP_HEADER_LENGTH   42   
    #define TLM_NGTP_HEADER_ITEM_SRV_TYPE_INCOMING_TRAFFIC TLM_SRV_TYPE_INCOMING_TRAFFIC
    //#]
    
    ////    Friends    ////
    

    ////    Constructors and destructors    ////
    
    
    ////    Operations    ////
    
    //## operation GetData(uint8_t*,uint32_t)
    BOOL GetData(uint8_t* buf, uint32_t size);
    
    //## operation SetData(uint8_t *,uint32_t)
    BOOL SetData(uint8_t * buf, uint32_t size);
    
    //## operation SetValue(uint8_t)
    BOOL SetValue(uint8_t value);
    
    tlmRmtCfgMsg();
    
    //## operation tlmRmtCfgMsg(uint8_t*,uint32_t)
    tlmRmtCfgMsg(const uint8_t* msgString, const uint32_t size);
    
    //## operation tlmRmtCfgMsg(uint8_t,uint8_t)
    tlmRmtCfgMsg(uint8_t srvType, uint8_t msgType);
    
    //## operation ~tlmRmtCfgMsg()
    ~tlmRmtCfgMsg();
    
    //## operation ParseInit()
    BOOL ParseInit();
    
    //## operation GetValue(uint8_t&)
    BOOL GetValue(uint8_t& value);
    
    //## operation GetHeaderItem(const uint8_t& code)
    tlmRmtCfgElement * GetHeaderItem(const uint8_t& code);
    
    //## operation GetSrvType(uint8_t &) const
    BOOL GetSrvType(uint8_t & srvType) const;
    
    //## operation SetSrvType(uint8_t &)
    BOOL SetSrvType(uint8_t & srvType);
    
    //## operation GetMsgType(uint8_t &) const
    BOOL GetMsgType(uint8_t & msgType) const;
    
    //## operation SetMsgType(uint8_t &)
    BOOL SetMsgType(uint8_t & msgType);
    
    //## operation SaveMsg() const
    BOOL SaveMsg() const;
    
    //## operation GetDataInfoLength(uint32_t&) const
    BOOL GetDataInfoLength(uint32_t& dataInfoLen) const;
    
    //## operation SetDataInfoLength(const uint32_t&)
    BOOL SetDataInfoLength(const uint32_t& dataInfoLen);
    
    // This function handle the data info message of incoming message.
    // Parse the data info and initialize component
    //## operation HandleData()
    BOOL HandleData();
    
    //## operation SetDataInfoMsgPtr(uint8_t*)
    void SetDataInfoMsgPtr(uint8_t* ptr);
    
    //## operation Init()
    BOOL Init();
    
    //## operation SetHdrProtocolVersion(uint8_t &)
    BOOL SetHdrProtocolVersion(uint8_t & proVer);
    
    //## operation SetHdrVin(uint8_t *)
    BOOL SetHdrVin(uint8_t * vin);
    
    //## operation SetHdrRoutInfo(uint16_t &)
    BOOL SetHdrRoutInfo(uint16_t & routeInfo);
    
    //## operation SetHdrUniqueId(uint16_t &)
    BOOL SetHdrUniqueId(uint16_t & msgUniqueId);
    
    //## operation SetHdrDateTime(uint32_t &)
    BOOL SetHdrDateTime(uint32_t & dateTime);
    
    //## operation SetHdrMsgProVersion(uint8_t &)
    BOOL SetHdrMsgProVersion(uint8_t & msgProVer);
    
    //## operation Fill()
    BOOL Fill();
    
    //## operation FillHeader()
    BOOL FillHeader();
    
    //## operation GetTotalSize() const
    uint32_t GetTotalSize() const;
    //## operation GetParaWeb()
    virtual tlmRmtCfgParaWeb* GetParaWeb();
    //## operation GetParaNavi()
    virtual tlmRmtCfgParaNavi* GetParaNavi();
    //## operation GetParaAdmin()
    virtual tlmRmtCfgParaAdmin* GetParaAdmin();

	//## operation SetItsService(tlmRmtCfgSrvApp)
    void SetItsService(tlmRmtCfgSrvApp* pSrv);

    //## operation GetOutMsgPtr() const
    uint8_t * GetOutMsgPtr() const;
    //## operation TranslateDateTime(uint8_t*)
    void TranslateDateTime(uint8_t* dateTime);
	//## auto_generated
    uint8_t* getMInMsgPtr() const;
        
    //## auto_generated
    uint8_t* getMOutMsgPtr() const;
protected :

    tlmRmtCfgElement mProtocolVersion;		//## attribute mProtocolVersion
    
    tlmRmtCfgElement mVin;		//## attribute mVin
    
    tlmRmtCfgElement mRouteInfo;		//## attribute mRouteInfo
    
    tlmRmtCfgElement mMsgUniqueId;		//## attribute mMsgUniqueId
    
    tlmRmtCfgElement mSrvType;		//## attribute mSrvType
    
    tlmRmtCfgElement mMsgType;		//## attribute mMsgType
    
    tlmRmtCfgElement mDateTime;		//## attribute mDateTime
    
    tlmRmtCfgElement mMsgProtocolVersion;		//## attribute mMsgProtocolVersion
    
    tlmRmtCfgElement mDataLength;		//## attribute mDataLength
    
    msgbuf mInboundMsgBuf;		//## attribute mInboundMsgBuf
    
    msgbuf mOutboundMsgBuf;		//## attribute mOutboundMsgBuf
    
    uint8_t* mInMsgPtr;		//## attribute mInMsgPtr
    
    uint8_t* mOutMsgPtr;		//## attribute mOutMsgPtr
    
    uint32_t mTotalSize;		//## attribute mTotalSize
    
    uint8_t* mDataInfoMsgPtr;		//## attribute mDataInfoMsgPtr
    
    tlmRmtCfgSaver* mSaver;		//## attribute mSaver
    
    tlmRmtCfgDataInfo* mDataInfo;		//## attribute mDataInfo

	tlmRmtCfgSrvApp* mItsService;         //## attribute mItsSerivce;
};
#endif
